package com.jr.service.impl;

import com.jr.mapper.CareProviderMapper;
import com.jr.pojo.CareProvider;
import com.jr.service.CareProviderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CareProviderServiceImpl implements CareProviderService {

    @Autowired
    private CareProviderMapper careProviderMapper;

    @Override
    public List<CareProvider> getAllApprovedProviders() {
        return careProviderMapper.selectAllApproved();
    }

    @Override
    public CareProvider getProviderById(Integer providerId) {
        return careProviderMapper.selectById(providerId);
    }

    @Override
    public CareProvider getProviderByUserId(Integer userId) {
        return careProviderMapper.selectByUserId(userId);
    }

    @Override
    public List<CareProvider> getProvidersByArea(String area) {
        return careProviderMapper.selectByServiceArea(area);
    }

    @Override
    public List<CareProvider> getTopRatedProviders(Integer limit) {
        return careProviderMapper.selectTopRated(limit);
    }
}
